﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace Readify.Management.Automation.GoGrid
{
    public class GoGridServerPassword
    {
        internal static GoGridServerPassword CreateFromXmlNode(XmlNode objectElementNode)
        {
            GoGridServerPassword output = new GoGridServerPassword();
            output.ID = GoGridHelper.GetAttributeElementValueFromXmlNodeAsNullableInt32(objectElementNode, "id");

            XmlNode serverAttributeXmlNode = GoGridHelper.GetAttributeElementFromXmlNodeAsFirstChildXmlNode(objectElementNode, "server");
            output.Server = GoGridServer.CreateFromXmlNode(serverAttributeXmlNode);

            output.ApplicationType = GoGridHelper.GetAttributeElementValueFromXmlNodeAsString(objectElementNode, "applicationtype");
            output.Username = GoGridHelper.GetAttributeElementValueFromXmlNodeAsString(objectElementNode, "username");
            output.Password = GoGridHelper.GetAttributeElementValueFromXmlNodeAsString(objectElementNode, "password");


            return output;
        }

        public int? ID { get; set; }
        public GoGridServer Server { get; set; }
        public string ApplicationType { get; set; }
        public string Username { get; set; }
        public string Password { get; set; }
    }
}
